{template '_header'}
<style type='text/css'>
	.ordertable { width:100%;position: relative;margin-bottom:10px}
	.ordertable tr td:first-child { text-align: right }
	.ordertable tr td {padding:8px 5px 0;vertical-align: top}
	.ordertable1 tr td { text-align: right; }
	.ops .btn { padding:5px 10px;}
    {if count($step_array)>4}.ui-step-4 li { width:20%;}{/if}
</style>
<div class="page-heading"> <h2>维权处理</h2> </div>
{if !empty($step_array)}
<div class="step-region" >
	<ul class="ui-step ui-step-4" >
        {loop $step_array $k1 $v1}
        <li {if $v1['done']==1}class="ui-step-done"{/if}>
            <div class="ui-step-title">{$v1['title']}</div>
            <div class="ui-step-number">{$v1['step']}</div>
            <div class="ui-step-meta">{if !empty($v1['time'])}{php echo date('Y-m-d',$v1['time'])}<br/>{php echo date('H:i:s',$v1['time'])}{/if}</div>
        </li>
        {/loop}
	</ul>
</div>
{/if}
   <form class="form-horizontal form" action="" method="post">
        <input type="hidden" name="id" value="{$item['id']}" />
        <input type="hidden" name="dispatchid" value="{$dispatch['id']}" />
 
	<div  class='row order-container'>
		<div class="order-container-left">
			<div class='panel-body' >
				 <h4 class="m-t-none m-b">维权信息</h4>
				 <div class="form-group" style='padding:0 10px;'>
					 <table class='ordertable' style='table-layout:fixed'>
						 <tr>
							 <td style='width:80px'>维权类型：</td>
                            <td>{$r_type[$refund['rtype']]}</td>
						 </tr>

                         {if $refund['rtype']!=2}
                         <tr>
                             <td style='width:80px'>退款金额：</td>
                             <td>{$refund['applyprice']}(元)</td>
                         </tr>
                         {/if}

                         <tr>
                             <td style='width:80px'>维权原因：</td>
                             <td>{$refund['reason']}</td>
                         </tr>

                         <tr>
                             <td style='width:80px'>维权说明：</td>
                             <td>{$refund['content']}</td>
                         </tr>

                         {if !empty($refund['images'])}
                         <tr>
                             <td style='width:80px'>图片凭证：</td>
                             <td>
                                 {loop $refund['images'] $k1 $v1}
                                 <a target='_blank' href='{php echo tomedia($v1)}'><img style='width:100px;;padding:1px;border:1px solid #ccc' src='{php echo tomedia($v1)}'></a>
                                 {php break;}
                                 {/loop}
                                 &nbsp;
                                 {if count($refund['images']) > 1}
                                 <a data-toggle='popover' data-html='true' data-placement='right'
                                    data-content="<table style='width:100%;'>
                        {loop $refund['images'] $k1 $v1}
                        <tr>
                        <td  style='border:none;text-align:right;padding:5px;'>
                            <a target='_blank' href='{php echo tomedia($v1)}'><img style='width:100px;;padding:1px;border:1px solid #ccc' src='{php echo tomedia($v1)}'></a>
                        </td>
                        </tr>
                        {/loop}
                </table>
">查看全部</a>
{/if}
                             </td>
                         </tr>
                         {/if}

                         <tr>
                             <td style='width:80px'>维权编号：</td>
                             <td>{$refund['refundno']}</td>
                         </tr>

                         <tr>
                             <td style='width:80px'>订单编号：</td>
                             <td><a href="{php echo webUrl('groups/order/detail', array('orderid' => $refund['orderid']))}" target="_blank" title="">{$refund['orderno']}</a></td>
                         </tr>

						 <tr>
							<td>订单金额：</td>
							<td>￥{php echo number_format($refund['price'],2)} <a data-toggle='popover' data-html='true' data-placement='right'
																			   data-content="<table style='width:100%;'>
                <tr>
                    <td  style='border:none;text-align:right;'>商品小计：</td>
                    <td  style='border:none;text-align:right;;'>￥{php echo number_format( $refund['price'] ,2)}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>运费：</td>
                    <td  style='border:none;text-align:right;;'>￥{php echo number_format( $refund['olddispatchprice'],2)}</td>
                </tr>
                {if $refund['discountprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>会员折扣：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $refund['discountprice'],2)}</td>
                </tr>
                {/if}
                {if $refund['deductprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>积分抵扣：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $refund['deductprice'],2)}</td>
                </tr>
                {/if}
                {if $refund['deductcredit2']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>余额抵扣：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $refund['deductcredit2'],2)}</td>
                </tr>
                {/if}
                {if $refund['deductenough']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>满额立减：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $refund['deductenough'],2)}</td>
                </tr>
                {/if}
                {if $refund['couponprice']>0}
                <tr>
                    <td  style='border:none;text-align:right;'>优惠券优惠：</td>
                    <td  style='border:none;text-align:right;;'>-￥{php echo number_format( $refund['couponprice'],2)}</td>
                </tr>
                {/if}
                {if intval($refund['changeprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改价：</td>
                    <td  style='border:none;text-align:right;;'><span style='{if 0<$refund['changeprice']}color:green{else}color:red{/if}'>{if 0<$refund['changeprice']}+{else}-{/if}￥{php echo number_format(abs($refund['changeprice']),2)}</span></td>
                </tr>
                {/if}
                {if intval($refund['changedispatchprice'])!=0}
                <tr>
                    <td  style='border:none;text-align:right;'>卖家改运费：</td>
                    <td  style='border:none;text-align:right;;'><span style='{if 0<$refund['changedispatchprice']}color:green{else}color:red{/if}'>{if 0<$refund['changedispatchprice']}+{else}-{/if}￥{php echo abs($refund['changedispatchprice'])}</span></td>
                </tr>
                {/if}
                <tr>
                    <td style='border:none;text-align:right;'>应收款：</td>
                    <td  style='border:none;text-align:right;color:green;'>￥{php echo number_format($refund['price']-$refund['creditmoney']+$refund['freight'],2)}</td>
                </tr>

            </table>
"><i class='fa fa-question-circle'></i></a></td>
						 </tr>

                         <tr>
                             <td>买家：</td>
                             <td>{$member['nickname']} <a data-toggle='popover' data-html='true' data-placement='right'
                                                          data-content="<table style='width:100%;'>
                <tr>
                    <td  style='border:none;text-align:right;' colspan='2'><img src='{$member['avatar']}' onerror=this.src='../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                </tr>
                                <tr>
                    <td  style='border:none;text-align:right;'>昵称：</td>
                    <td  style='border:none;text-align:right;'>{$member['nickname']}</td>
                </tr>
                {if $member['realname']}
                <tr>
                    <td  style='border:none;text-align:right;'>姓名：</td>
                    <td  style='border:none;text-align:right;'>{$member['realname']}</td>
                </tr>
                {/if}
                <tr>
                    <td  style='border:none;text-align:right;'>ID：</td>
                    <td  style='border:none;text-align:right;'>{$member['id']}</td>
                </tr>
                {if $member['mobile']}
                <tr>
                    <td  style='border:none;text-align:right;'>手机号：</td>
                    <td  style='border:none;text-align:right;'>{$member['mobile']}</td>
                </tr>
                {/if}
                {if $member['weixin']}
                <tr>
                    <td  style='border:none;text-align:right;'>微信号：</td>
                    <td  style='border:none;text-align:right;'>{$member['weixin']}</td>
                </tr>
                {/if}
                </table>
"><i class='fa fa-question-circle'></i></a></td>
                         </tr>

                         <tr>
                             <td style='width:80px'>付款时间：</td>
                             <td>{php echo date('Y-m-d H:i:s', $refund['paytime'])}</td>
                         </tr>

                         <tr>
                             <td style='width:80px'>付款方式：</td>
                             <td>
                                 {if $refund['pay_type']=='wechat'}
                                 <span class='label label-danger'>微信支付</span>
                                 {elseif $refund['pay_type']=='credit'}
                                 <span class='label label-danger'>余额支付</span>
                                 {elseif $refund['pay_type']=='alipay'}
                                 <span class='label label-danger'>支付宝支付</span>
                                 {elseif $refund['pay_type']}
                                 <span class='label label-default'>{$refund['pay_type']}</span>
                                 {elseif $refund['pay_type']==''}
                                 <span class='label label-default'>未付款</span>
                                 {/if}
                             </td>
                         </tr>

                     </table>

                </div>
			</div>
		</div>

        <div class="order-container-right" >
            <div class='panel-body' style='height:450px;' >

                <div class='row'>
                    <div class='col-sm-3 control-label' style='padding-top:10px;'>维权状态: </div>
                    <div class="col-sm-9 col-xs-12">
                        <h3 class="form-control-static">
                            {if $refund['refundstatus'] == -2}<span class="text-default">客户取消{$r_type[$refund['rtype']]}</span>
                            {else if $refund['refundstatus'] == -1}<span class="text-default">已拒绝{$r_type[$refund['rtype']]}</span>
                            {else if $refund['refundstatus'] == 0}<span class="text-warning">等待商家处理申请</span>
                            {else if $refund['refundstatus'] == 1}<span class="text-default">{$r_type[$refund['rtype']]}完成</span>
                            {else if $refund['refundstatus'] == 3}<span class="text-warning">等待客户退回物品</span>
                            {else if $refund['refundstatus'] == 4}<span class="text-warning">客户退回物品，等待商家重新发货</span>
                            {else if $refund['refundstatus'] == 5}<span class="text-warning">等待客户收货</span>{/if}
                        </h3>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static ops">

                            {if ($refund['refundstatus'] == 0 || $refund['refundstatus'] > 1)}
                            <a class="btn btn-primary btn-xs" data-toggle="ajaxModal"  href="{php echo webUrl('groups/refund/submit', array('id' => $item['id'],'refundid' => $refund['id']))}">处理申请</a>
                            {/if}
                        </p>
                    </div>
                </div>

                {if $refund['rtype']>0 && !empty($refund['expresssn'])}
                <div class='row'>
                    <div class='col-sm-3 control-label' style='padding-top:10px;'>
                        客户退回物品 :
                    </div>
                    <div class="col-sm-9 col-xs-12">
                            <div class="form-control-static">
                                快递公司: {if empty($refund['expresscom'])}其他快递{else}{$refund['expresscom']}{/if}<br>
                                快递单号: {$refund['expresssn']} &nbsp;&nbsp;&nbsp;<a class='op' data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$refund['express'],'expresssn'=>$refund['expresssn']))}">查看物流</a><br>
                                退回时间: {php echo date('Y-m-d H:i:s', $refund['sendtime'])}
                            </div>
                    </div>
                </div>
                {/if}

                {if $refund['rtype']==2 && !empty($refund['rexpresssn'])}
                <div class='row'>
                    <div class='col-sm-3 control-label' style='padding-top:10px;'>
                        商家寄出物品 :
                    </div>
                    <div class="col-sm-9 col-xs-12">
                        <div class="form-control-static">
                            快递公司: {if empty($refund['rexpresscom'])}其他快递{else}{$refund['rexpresscom']}{/if}<br>
                            快递单号: {$refund['rexpresssn']} &nbsp;&nbsp;&nbsp;<a class='op' data-toggle="ajaxModal" href="{php echo webUrl('util/express', array('id' => $item['id'],'express'=>$refund['rexpress'],'expresssn'=>$refund['rexpresssn']))}">查看物流</a><br>
                            发货时间: {php echo date('Y-m-d H:i:s', $refund['returntime'])}
                        </div>
                    </div>
                </div>
                {/if}


                <!--<div class='order-tips'>-->
                    <!--<div class='row order-tips-title'>友情提醒</div>-->
                      <!--<div class='row order-tips-row'>订单为货到付款，请您务必联系买家确认后再进行发货</div>-->
                <!--</div>-->

            </div>

        </div>
 
</div>

       <br>
       <div class="panel panel-default">
           <div class="panel-heading">
               <span>商品信息</span>
           </div>
           <div class="panel-body table-responsive">
               <table class="table table-hover">
                   <thead class="navbar-inner">
                   <tr>
                       <th style="width:200px">标题</th>
                       <th>商品图片</th>
                       <th style="text-align: center;">单价(元)/数量</th>
                       <th style="text-align: center;">金额(元)</th>
                       {if !empty($refund['diyformdata'])}
                       <th style="width:80px;"></th>
                       {/if}
                       <!--<th style="width:5%;">操作</th>-->
                   </tr>
                   </thead>
                   <tr>
                       <td class='full'>
                           {$refund['title']}
                       </td>
                       <td>
                           <img src="{php echo tomedia($refund['thumb'])}" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'>
                       </td>
                       <td style="text-align: right;">
                           ¥ {$refund['groupsprice']}
                           <br/>x1
                       </td>
                       <td style='color:red;font-weight:bold;text-align: center;'>
                           ¥ {php echo number_format($refund['price'] + $refund['freight'],2)}<br />
                           (含运费:¥ {php echo number_format($refund['freight'],2)})
                       </td>
                       {if !empty($refund['diyformdata'])}
                       <td>
                           <a href='javascript:;' class=btn-xs' hide="1"  data="{$refund['goodid']}" onclick="showDiyInfo(this)">自定义信息</a>
                       </td>
                       {/if}
                       <!--td>
                           <a href="{php echo webUrl('goods/edit', array('id' => $goods['id']))}" class="btn btn-default btn-sm" title="编辑"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;
                       </td-->
                   </tr>
                   {if !empty($refund['diyformdata'])}
                   <tr>
                       <td colspan='5'>
                           <table class='ordertable' style='table-layout:fixed;display: none;' id="diyinfo_{$refund['goodid']}">
                               {php $datas = $refund['diyformdata']}
                               {loop $refund['diyformfields'] $key $value}
                               <tr>
                                   <td style='width:80px'>{php echo $value['tp_name']}：</td>
                                   <td>
                                       {template 'diyform/diyform'}
                                   </td>
                               </tr>
                               {/loop}
                           </table>
                       </td>
                   </tr>
                   {/if}
               </table>
           </div>
       </div>
   </form>

{template '_footer'}
